﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Text;

namespace down2App
{
    class FileInf
    {
        /// <summary>
        /// 任务唯一标识，32位GUID
        /// </summary>
        public string id = string.Empty;
        /// <summary>
        /// 父级ID
        /// </summary>
        public string pid = string.Empty;
        public int uid = 0;
        /// <summary>
        /// 文件本地名称
        /// </summary>
        public string nameLoc = string.Empty;
        /// <summary>
        /// 
        /// </summary>
        public string nameSvr = string.Empty;
        /// <summary>
        /// 文件本地完整路径
        /// </summary>
        public string pathLoc = string.Empty;
        /// <summary>
        /// 本地目录
        /// </summary>
        public string folderLoc = string.Empty;
        /// <summary>
        /// 文件url
        /// </summary>
        public string fileUrl = string.Empty;
        /// <summary>
        /// 本地文件大小，已经下载的文件大小
        /// </summary>
        public long lenLoc = 0;
        /// <summary>
        /// 远程文件大小
        /// </summary>
        public long lenSvr = 0;
        /// <summary>
        /// 下载百分比
        /// </summary>
        public string perLoc = "0%";
        /// <summary>
        /// 格式化的远程文件大小，比如：10MB
        /// </summary>
        public string sizeSvr = "0byte";
        /// <summary>
        /// 下载完毕
        /// </summary>
        public bool complete = false;
        /// <summary>
        /// 文件夹下载任务
        /// </summary>
        public bool fdTask = false;

        public void fromJson(JToken o)
        {
            this.id = o["id"].ToString();
            this.nameLoc = o["nameLoc"].ToString();
            this.fileUrl = o["fileUrl"].ToString();
        }
    }
}
